package cn.cscb.mms.common.context;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

/**
 * 存储每个线程的私有数据，确保数据在每个线程中都是独立的
 *
 * @author Gao Yipeng
 */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class BaseContext {

    private static final ThreadLocal<String> threadLocal = new ThreadLocal<>();

    public static void setCurrentEmpNo(String empNo) {
        threadLocal.set(empNo);
    }

    public static String getCurrentEmpNo() {
        return threadLocal.get();
    }

    public static void removeCurrentEmpNo() {
        threadLocal.remove();
    }
}
